<?php
/**
 * Created by PhpStorm.
 * User: ASUS
 * Date: 2020/9/10
 * Time: 13:00
 */

namespace app\pcApi\queue;



use think\Controller;

class Queue extends Controller
{
    protected $redis = "";

    protected $queue_name = "queue";

    public function initialize()
    {
        $this->redis = new \Redis();
        $this->redis->connect('127.0.0.1', 6379);
    }
    //进队列
    public function pushQueue()
    {
        dump(11);
        $a = ["A","B","C","D","E","F"];
        foreach ($a as $k=>$v){
            $this->redis->rpush($this->queue_name,$v);
        }
//        $this->redis->rpush($this->queue_name,$value);
    }
    //出队列
    public function popQueue()
    {
        $value = $this->redis->lpop($this->queue_name);
        while ($value){
            echo "出队的值".$value;
        }
    }
}